package com.aabte.design2.behavioral.memento.v1;

/**
 * @author Daniel
 * @version 1.0
 * @date 2020/5/4
 */
public class Application {

    public static void main(String[] args) {
        Editor editor = new Editor();
        editor.setText("abcdefg");
        editor.setCurX(1);
        editor.setCurY(1);
        editor.setSelectionWidth(2);
        System.out.println("init status editor = " + editor);

        BackupCommand backupCommand = new BackupCommand(editor);
        backupCommand.makeBackup();

        editor.setText("xyz");
        editor.setCurX(2);
        System.out.println("changed status editor = " + editor);

        backupCommand.undo();
        System.out.println("undo status editor = " + editor);
    }

}
